/**
 *	流程模块分组
 *	开发者：雨中磐石
 *	地址：www.rockoa.com
 *	日期：2023-07-19
 */

package com.framework.Flow;


import com.framerock.baselib.Rock;
import com.rock.xinhujava.RainRock;

import java.util.Map;

public class FlowGroup {

    private static Map<String,String> allGroup = null;

    //设置一些组
    private static void setGroup()
    {
        String arrstr;
        allGroup = Rock.getMap();
        //系统组
        arrstr  = "users,usera,token,task,option,menu,dept,company,file";
        allGroup.put("system", arrstr);

        //流程模块组
        arrstr  = "flowwhere,flowunit,flowtodo,flowset,flowmenu,flowlog,flowelement,flowauth,flowcourse,flowbill";
        allGroup.put("flow", arrstr);

        //REIM组
        arrstr  = "imgroup,imgroupuser,imhistory,immess";
        allGroup.put("REIM", arrstr);

        //基础模块组
        arrstr  = "todo,schedule,notice,remind,meet";
        allGroup.put("base", arrstr);

        //进销存
        arrstr  = "jxcstock,jxcgoods,jxcgoodn,jxccrku,jxcbase";
        allGroup.put("jxc", arrstr);

        //以下读取用户自己设置的
        Map<String,String> userGroup = RainRock.getMyModuleGroup();
        for (Map.Entry<String, String> entry : userGroup.entrySet())allGroup.put(entry.getKey(), entry.getValue());
    }

    /**
     * 获取所有的分组
     * */
    public static Map<String,String> getAllGroup()
    {
        if(allGroup == null)setGroup();
        return allGroup;
    }

    /**
     * 读取分组的
     * */
    public static String get(String num)
    {
        String bstr = "";
        if(allGroup == null)setGroup();
        String key,varr[];
        for (Map.Entry<String, String> entry : allGroup.entrySet()) {
            varr = entry.getValue().split(",");
            key  = entry.getKey();
            if(Rock.inArray(varr, num)){
                bstr = key;
                break;
            }
        }
        return bstr;
    }
}
